﻿import request from '/@/utils/request';
enum Api {
  AddStudent = '/api/student/add',
  DeleteStudent = '/api/student/delete',
  UpdateStudent = '/api/student/update',
  PageStudent = '/api/student/page',
  DetailStudent = '/api/student/detail',
  GetBanjiBanjiIdDropdown = '/api/student/BanjiBanjiIdDropdown',
  GetJiaoxueBanBanjiIdDropdown = '/api/student/JiaoxueBanBanjiIdDropdown',
  ImportStudent = '/api/student/import',
  PageJiaoxueBanStudent = '/api/student/pageJiaoxueBan',
  InitStudentUser = '/api/student/initStudentUser',
  ExportStudent = '/api/student/export',
  
}

// 增加学生
export const addStudent = (params?: any) =>
	request({
		url: Api.AddStudent,
		method: 'post',
		data: params,
	});

// 删除学生
export const deleteStudent = (params?: any) => 
	request({
			url: Api.DeleteStudent,
			method: 'post',
			data: params,
		});

// 编辑学生
export const updateStudent = (params?: any) => 
	request({
			url: Api.UpdateStudent,
			method: 'post',
			data: params,
		});

// 分页查询学生
export const pageStudent = (params?: any) => 
	request({
			url: Api.PageStudent,
			method: 'post',
			data: params,
		});

// 详情学生
export const detailStudent = (id: any) => 
	request({
			url: Api.DetailStudent,
			method: 'get',
			data: { id },
		});

export const getBanjiBanjiIdDropdown = () =>
		request({
		url: Api.GetBanjiBanjiIdDropdown,
		method: 'get'
		});

export const getJiaoxueBanBanjiIdDropdown = () =>
		request({
		url: Api.GetJiaoxueBanBanjiIdDropdown,
		method: 'get'
		});

export const importStudent = (fileId: any) => 
		request({
				url: Api.ImportStudent,
				method: 'post',
				data: { id:fileId },
			});

			// 分页查询学生
export const pageJiaoxueBanStudent = (params?: any) => 
		request({
				url: Api.PageJiaoxueBanStudent,
				method: 'post',
				data: params,
			});
			
export const initStudentUser = (params?: any) =>
			request({
				url: Api.InitStudentUser,
				method: 'post',
				data: params,
			});

export const exportStudent = (params?: any) => 
			request({
					url: Api.ExportStudent,
					method: 'post',
					data: params,
					responseType: "blob"
				});